package com.example.gui;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.LinearLayout;

import com.google.android.material.bottomnavigation.BottomNavigationView;

public class Navigation extends AppCompatActivity {
    private LinearLayout contentLinearLayout;
    private BottomNavigationView bottomNavigationView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_navigation);

        contentLinearLayout = findViewById(R.id.contentLinearLayout);
        bottomNavigationView = findViewById(R.id.bottomNavigationView);

        contentLinearLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // contentLinearLayout被点击，跳转到相应的Activity
                Intent intent = new Intent(Navigation.this, SetPostActivity.class);
                startActivity(intent);
            }
        });

        bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
            @Override
            public boolean onNavigationItemSelected(@NonNull MenuItem item) {
                if (item.getItemId() == R.id.conversation_list) {
                    Intent intent1 = new Intent(Navigation.this, HomeActivity.class);
                    startActivity(intent1);
                    return true;
                } else if (item.getItemId() == R.id.contact) {
                    Intent intent2 = new Intent(Navigation.this, SetPostActivity.class);
                    startActivity(intent2);
                    return true;
                }
                // 添加其他导航项的处理逻辑
                return false;
            }
        });

    }
}
